package madoop.reign;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;


public class Platform
{
    String[] classpath;
    String   main;
    String[] arguments;
    int      port;


    public Platform(Properties prop)
    {
        List<String> paths = new ArrayList<String>();
        String cp = prop.getProperty("platform.classpath");
        if (cp != null) {
            for (String path : cp.split(":")) {
                path = path.trim();
                if (path.length() == 0)
                    continue;
                paths.add(path);
            }
        }
        classpath = paths.toArray(new String[0]);
        main = prop.getProperty("platform.main");
        String args = prop.getProperty("platform.arguments");
        if (args == null)
            return;
        arguments = args.split("[ \t]+");

        port = Integer.parseInt(prop.getProperty("platform.port"));
    }
}
